<template>
  <!-- 定义在这里的参数都是不可在外部覆盖的，防止出现问题 -->
  <j-select-custom-component
    :value="value"
    :ellipsisLength="25"
    :listUrl="url.list"
    :columns="columns"
    v-on="$listeners"
    v-bind="attrs"
    :queryParams="queryParams"
    ref="JSelectCustomComponent"
  />
</template>

<script>

    import JSelectCustomComponent from '@/components/jeecgbiz/JSelectCustomComponent/index'

    export default {
        name: 'JSelectMat',
        components: {JSelectCustomComponent},
        props: {
            matCode: {
                required: false,
                default: ''
            },
            matName: {
                required: false,
                default: ''
            },
          matStandard:{
            required: false,
            default: ''
          },
          matLenght:{
            required: false,
            default: ''
          },
          matWeight:{
            required: false,
            default: ''
          },
          matUnit:{
            required: false,
            default: ''
          },
          className:{
            required: false,
            default: ''
          },
          value:{
            type:String,
            required:false
          }
        },

        data() {
            return {
                url: {
                    list: '/materiel/materiel/list'
                },
                columns: [
                    {title: '物料编号', dataIndex: 'matCode', align: 'center'},
                    {title: '物料名称', dataIndex: 'matName', align: 'center'},
                    {title: '规格', dataIndex: 'matStandard', align: 'center'},
                    {title: '长度', dataIndex: 'matLenght', align: 'center'},
                    {title: '重量', dataIndex: 'matWeight', align: 'center'},
                    {title: '单位', dataIndex: 'matUnit', align: 'center'},
                    {title: '分类', dataIndex: 'className', align: 'center'},
                ],
                // 定义在这里的参数都是可以在外部传递覆盖的，可以更灵活的定制化使用的组件
                default: {
                    name: '选择物料',
                    width: 1200,
                    orgFields: '',
                    destFields: '',
                    displayKey: 'matCode',
                    returnKeys: ['id', 'matCode','matName','matStandard','matUnit','matLenght','matWeight'],
                },
                queryParams: [{
                    label: '物料编号',
                    key: 'matCode'
                }, {
                    label: '物料名称',
                    key: 'matName',
                },{
                  label: '规格',
                  key: 'matStandard',
                },{
                  label: '分类',
                  key: 'className',
                }],
            }
        },
        computed: {
            attrs() {
                return Object.assign(this.default, this.$attrs)
            }
        }
    }
</script>

<style lang="less" scoped></style>